let account_ipt = document.querySelector(".account_ipt");
let password_ipt = document.querySelector(".password_ipt");
let login_title = document.querySelector(".login_title");
let login_button = document.querySelector("#login_button");
account_ipt.addEventListener("focus", function () {
    let login_account = document.querySelector(".login_account");
    let account_ipts = account_ipt.value;
    if (account_ipts == "") {
        login_account.className = "login_accounts";
    }
})
account_ipt.addEventListener("blur", function () {
    let account_ipts = account_ipt.value;
    let login_accounts = document.querySelector(".login_accounts");
    if (account_ipts == "") {
        login_accounts.className = "login_account";
    }
})

password_ipt.addEventListener("focus", function () {
    let login_password = document.querySelector(".login_password");
    let password_ipts = password_ipt.value;
    if (password_ipts == "") {
        login_password.className = "login_passwords";
    }
})
password_ipt.addEventListener("blur", function () {
    let password_ipts = password_ipt.value;
    let login_passwords = document.querySelector(".login_passwords");
    if (password_ipts == "") {
        login_passwords.className = "login_password";
    }
})
login_button.addEventListener("click", function () {
    let account_ipts = account_ipt.value;
    let password_ipts = password_ipt.value;
    let account = 1;
    let password = 1;
    if (account_ipts == account && password_ipts == password) {
        let login_accounts = document.querySelector(".login_accounts");
        let login_passwords = document.querySelector(".login_passwords");
        login_title.style.fontSize = "18px";
        login_title.style.color = "white";
        login_title.innerHTML = "欢迎";
        setTimeout(function () {
            account_ipt.value = "",
                password_ipt.value = "",
                login_accounts.className = "login_account",
                login_passwords.className = "login_password";
        }, 1500);
        setTimeout(function () { window.location = "chata.html" }, 2000);
    } else {
        login_title.style.fontSize = "16px";
        login_title.style.color = "red";
        login_title.innerHTML = "账号或密码有误";
    }
})